<html><head><title>Specify Ridge regression  In A GAMLSS Formula</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>ridge(gamlss)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   ridge">
<param name="keyword" value="R:   ri">
<param name="keyword" value=" Specify Ridge regression  In A GAMLSS Formula">
</object>


<h2>Specify Ridge regression  In A GAMLSS Formula</h2>


<h3>Description</h3>

<p>
The function <code>ri()</code> allow the user to fit a ridge regression within GAMLSS. 
It allows the coefficients of a set of explanatory variables to be shrunk towards an overall zero, 
where the amount of shrinking depends either on lambda, or on the equivalent degrees of freedom (df). 
The function <code>ri()</code> can estimate lambda a local REML-algorithm.
</p>


<h3>Usage</h3>

<pre>
ridge(X, df = NULL, lambda = NULL, order = 0)
ri(X, df = NULL, lambda = NULL, order = 0, start = 10)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>X</code></td>
<td>
A standardized (mean=0, sd-1)  matrix  <code>X</code> of explanatory variables  </td></tr>
<tr valign="top"><td><code>df</code></td>
<td>
the effective degrees of freedom <code>df</code>  </td></tr>
<tr valign="top"><td><code>lambda</code></td>
<td>
the smoothing parameter <code>lambda</code></td></tr>
<tr valign="top"><td><code>order</code></td>
<td>
the <code>order</code> of the difference applied to the coefficients </td></tr>
<tr valign="top"><td><code>start</code></td>
<td>
the lambda starting value if the Schall's EM-algorithm is used</td></tr>
</table>

<h3>Value</h3>

<p>
x is returned with class "smooth", with an attribute named "call" which is to be evaluated in the backfitting  <code>additive.fit()</code> 
called by <code>gamlss()</code></p>

<h3>Author(s)</h3>

<p>
Mikis Stasinopoulos <a href="mailto:d.stasinopoulos@londonmet.ac.uk">d.stasinopoulos@londonmet.ac.uk</a>, Bob Rigby <a href="mailto:r.rigby@londonmet.ac.uk">r.rigby@londonmet.ac.uk</a> and Paul Eilers
</p>


<h3>References</h3>

<p>
Rigby, R. A. and  Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), 
<EM>Appl. Statist.</EM>, <B>54</B>, part 3, pp 507-554.
</p>
<p>
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R.
Accompanying documentation in the current GAMLSS  help files, (see also  <a href="http://www.gamlss.com/">http://www.gamlss.com/</a>).
</p>
<p>
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
<EM>Journal of Statistical Software</EM>, Vol. <B>23</B>, Issue 7, Dec 2007, <a href="http://www.jstatsoft.org/v23/i07">http://www.jstatsoft.org/v23/i07</a>.
</p>


<h3>See Also</h3>

<p>
<code><a href="ra.html">ra</a></code>,  <code><a href="gamlss.html">gamlss</a></code>
</p>


<h3>Examples</h3>

<pre>
data(usair)
# standarized the x's
for (i in 2:7) usair[,i] &lt;- (usair[,i]-mean(usair[,i]))/sd(usair[,i])
# create a matrix 
usair$X &lt;-as.matrix(usair[,c("x1","x2", "x3","x4", "x5", "x6")])
m1&lt;- gamlss(y~ridge(X, df=3), data=usair, family=GA)
m2&lt;- gamlss(y~ridge(X, lambda=10), data=usair, family=GA)
# plotting the coeficients as function of the df 
df &lt;- seq(0,6,0.5)
resmat&lt;-matrix(0, nrow=length(df), ncol=6)
for (i in 1:length(df)) 
{
resmat[i,] &lt;- gamlss(y~ridge(X, df=df[i]), data=usair)$mu.coefSmo[[1]][["coef"]]
}
colnames(resmat)&lt;-colnames(usair$X)
plot(1:length(df), type="n", xlim=c(-.5,6.5), ylim=c(-23, 38))
for (i in 1:6)
{
lines(resmat[,i]~df, col="purple")
points(resmat[,i]~df)
}
lines(rep(0,length(df))~df, col="black")
# now estimating the lambda
 g1&lt;-gamlss(y~ri(X), data=usair)
  m1$mu.coefSmo
</pre>



<hr><div align="center">[Package <em>gamlss</em> version 2.0-0 <a href="00Index.html">Index</a>]</div>

</body></html>
